@extends('layout.adminindex')
@section('title', '后台用户管理首页')




@section('topmain')
<div class="top">
            <div class="topleft">
            <a href="{{url('/admin')}}" target="_parent"><img src="{{ URL::asset('adminlizzj/images/logo.png') }}" title="系统首页" /></a>
            </div>  
            <ul class="nav">
            <li><a href="{{url('/admin')}}"  class="selected"><img src="{{ URL::asset('adminlizzj/images/icon01.png') }}" title="后台首页" /><h2>后台首页</h2></a></li>
            <li><a href="{{url('/admin/cate')}}" ><img src="{{ URL::asset('adminlizzj/images/icon02.png') }}" title="导航管理" /><h2>导航管理</h2></a></li>
             <li><a href="{{url('/admin/content')}}" ><img src="{{ URL::asset('adminlizzj/images/icon03.png') }}" title="内容管理" /><h2>内容管理</h2></a></li>
            <li><a href="#" ><img src="{{ URL::asset('adminlizzj/images/icon04.png') }}" title="常用工具" /><h2>常用工具</h2></a></li>
            <li><a href="#" ><img src="{{ URL::asset('adminlizzj/images/icon05.png') }}" title="文件管理" /><h2>文件管理</h2></a></li>
            <li><a href="#" ><img src="{{ URL::asset('adminlizzj/images/icon06.png') }}" title="系统设置" /><h2>系统设置</h2></a></li>
            </ul>   
            <div class="topright">    
            <ul>
            <li><a href="{{url('/')}}">前台首页</a></li>
            <li><span><img src="{{ URL::asset('adminlizzj/images/help.png') }}" title="帮助"  class="helpimg"/></span><a href="#">帮助</a></li>
            <li><a href="#">关于</a></li>
            <!-- 关于退出部分的操作  点击过去然后 获取session中的id  然后查找logining 将获取的值相相互等于一下就好了 然后-->
            <li><a href="{{url('/admin/login/loginout')}}" >退出</a></li>
            </ul>
            <div class="user">
            @if(Session::has('username'))           
            <span>{{Session::get('username')}} </span>
            @endif
            <i>{{$usersessioninfo->userlevel}}</i>
            <b>5</b>
            </div>    
            </div>
        </div>
@endsection


@section('leftmain')
<div class="indexleft">
 	<div class="lefttop"><span></span>快捷管理</div>
    
   <dl class="leftmenu">
        
    <dd>
    <div class="title">
    <span><img src="{{ URL::asset('adminlizzj/images/leftico01.png') }}" /></span>管理信息
    </div>
    	<ul class="menuson" style="display: none;">
        <li><cite></cite><a href="">首页模版</a><i></i></li>
        <li><cite></cite><a href="">数据列表</a><i></i></li>
        <li><cite></cite><a href="#">图片数据表</a><i></i></li>
        <li><cite></cite><a href="#">添加编辑</a><i></i></li>
        <li><cite></cite><a href="#">图片列表</a><i></i></li>
        <li><cite></cite><a href="#">自定义</a><i></i></li>
        <li><cite></cite><a href="#">常用工具</a><i></i></li>
        <li><cite></cite><a href="#">信息管理</a><i></i></li>
        <li><cite></cite><a href="#">Tab页</a><i></i></li>
        <li><cite></cite><a href="#">404页面</a><i></i></li>
        </ul>    
    </dd>
        
    
    <dd>
    <div class="title">
    <span><img src="{{ URL::asset('adminlizzj/images/leftico02.png') }}" /></span>其他设置
    </div>
    <ul class="menuson">
        <li><cite></cite><a href="#">编辑内容</a><i></i></li>
        <li><cite></cite><a href="#">发布信息</a><i></i></li>
        <li><cite></cite><a href="#">档案列表显示</a><i></i></li>
        </ul>     
    </dd> 
    <dd><div class="title"><span><img src="{{ URL::asset('adminlizzj/images/leftico03.png') }}" /></span>编辑器</div>
    <ul class="menuson">
        <li><cite></cite><a href="#">自定义</a><i></i></li>
        <li><cite></cite><a href="#">常用资料</a><i></i></li>
        <li><cite></cite><a href="#">信息列表</a><i></i></li>
        <li><cite></cite><a href="#">其他</a><i></i></li>
    </ul>    
    </dd>  
    <dd><div class="title"><span><img src="{{ URL::asset('adminlizzj/images/leftico04.png') }}" /></span>日期管理</div>
    <ul class="menuson">
        <li><cite></cite><a href="#">自定义</a><i></i></li>
        <li><cite></cite><a href="#">常用资料</a><i></i></li>
        <li><cite></cite><a href="#">信息列表</a><i></i></li>
        <li><cite></cite><a href="#">其他</a><i></i></li>
    </ul>
    
    </dd>   
				<!-- 修改的部分开始 -->
		     <dd><div class="title"><span><img src="{{ URL::asset('adminlizzj/images/leftico04.png') }}" /></span><a href="#">用户管理</a></div>
		    <ul class="menuson" style="display: block;">
		        <li class="active"><cite></cite><a href="{{url('/admin/user')}}">用户列表</a><i></i></li>
		        <li><cite></cite><a href="{{url('/admin/user/add')}}">用户添加</a><i></i></li>
		    </ul>
		    </dd> 
			<!-- 修改的部分结束 -->
    </dl>
   </div>

		@endsection

		@section('rightmain')


	<div class="place"  style="width:1300px">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="{{url('/admin')}}">首页</a></li>
    <li><a href="{{url('/admin/user')}}">用户管理</a></li>
    <li><a href="#">用户列表</a></li>
    </ul>
    </div>
            <div id="errorshow">

                @if (session('success'))
                    <div class="alert alert-success">
                        {{ session('success') }}
                    </div>
                @endif
                @if (session('error'))
                    <div class="alert alert-error">
                        {{ session('error') }}
                    </div>
                @endif
            </div>
    <div class="rightinfo">
    
    <div class="tools">
    
    	<ul class="toolbar">
  	        <li><a href="{{url('/admin/user/add')}}"><span><img src="{{ URL::asset('adminlizzj/images/t01.png') }}" /></span>添加</a></li>
            <li class="clicks" id="getValue"><span><img src="{{ URL::asset('adminlizzj/images/t03.png') }}" /></span>删除</li>
            
        </ul>

	    <form action="/admin/user/index" method="get">   
       	<ul class="seachform">
            <li>&nbsp;&nbsp;&nbsp;&nbsp;</li>
            
            
        <li><label>权限</label>  
            <div class="vocation">
            <div class="uew-select"><select class="select3" style="width: 140px;" name="userlevel">
            <option value=""  @if(!empty($request['userlevel']) && $request['userlevel']=='')
                                            selected 
                                @endif
            >全部查询</option>
            <option value="1"  @if(!empty($request['userlevel']) && $request['userlevel']=='1')
                                            selected 
                                @endif
            >超级管理员</option>
            <option value="2"   @if(!empty($request['userlevel']) && $request['userlevel']=='2')
                                            selected 
                                @endif
            >普通管理员</option>
            <option value="3"   @if(!empty($request['userlevel']) && $request['userlevel']=='3')
                                            selected 
                                @endif
            >临时管理员</option>
            </select></div>
            </div>
        </li>
            
            <li><label>审核状态</label>  
            <div class="vocation">
            <div class="uew-select"><select class="select3" style="width: 100px;"name="useraudit">
            <option value=""     @if(!empty($request['useraudit']) && $request['useraudit']=='')
                                            selected 
                                @endif

            >全部查询</option>
            <option value="yes"  @if(!empty($request['useraudit']) && $request['useraudit']=='yes')
                                            selected 
                                @endif

            >已审核</option>
             <option value="no"  @if(!empty($request['useraudit']) && $request['useraudit']=='no')
                                            selected 
                                @endif

             >未审核</option>
            </select></div>
            </div>
            </li>
            
            <li><label>激活状态</label>  
            <div class="vocation">
            <div class="uew-select"><select class="select3" style="width: 100px;"name="userstatus">
            <option value=""    @if(!empty($request['userstatus']) && $request['userstatus']=='')
                                            selected 
                                @endif

             >全部查询</option>
            <option value="yes" @if(!empty($request['userstatus']) && $request['userstatus']=='yes')
                                            selected 
                                @endif
            >已激活</option>
            <option value="no"  @if(!empty($request['userstatus']) && $request['userstatus']=='no')
                                            selected 
                                @endif
            >未激活</option>
            </select></div>
            </div>
            </li>
            <li>&nbsp;&nbsp;&nbsp;&nbsp;</li>
            <li><label>用户名查询</label><input name="username" class="scinput" type="text" value="{{$request['username'] or ''}}"></li>
             <li><label>每页显示</label>  
            <div class="vocation">
            <div class="uew-select"><select class="select3" style="width: 100px;"name="usernum">
            <option value="10"   @if(!empty($request['usernum']) && $request['usernum']==10)
                                            selected 
                                @endif
            >10条数据</option>
            <option value="20" @if(!empty($request['usernum']) && $request['usernum']==20)
                                            selected 
                                @endif
            
            >20条数据</option>
            <option value="30"  @if(!empty($request['usernum']) && $request['usernum']==30)
                                            selected 
                                @endif
            >30条数据</option>
            </select></div>
            </div>
            </li>
            <li><label>&nbsp;</label><input name="" class="scbtn" value="查询" type="submit"></li>
        </ul>
    </form> 
    </div>
    
    
    <table class="tablelist" id="listlizzj">
    	<thead>
    	<tr>
        <th><input name="" value=""  type="checkbox"></th>

        <th>用户编号</th>
        <th>用户名</th>
        <th>添加时间</th>
        <th>用户权限</th>
        <th>用户邮箱</th>
        <th>添加人</th>
        <th>是否审核</th>
        <th>是否激活</th>
        <th>备注</th>
        <th>操作</th>
        </tr>
        </thead>
        <tbody>
       @foreach($adminusers as $k=>$v)
        <tr class="" >
            <td><input name=""  type="checkbox" value="{{$v->id}}"></td>
        
            <td>{{$v->userid}}</td>
            <td>{{$v->username}}</td>
            <td>{{$v->usertime}}</td>
            <td>{{$v->userlevel}}</td>
            <td>{{$v->useremail}}</td>
            <td>{{$v->useradd }}</td>
            <td>{{$v->useraudit}}</td>
            <td>{{$v->userstatus}}</td>
            <td>{{$v->userremark }}</td>
             <td><a href="#" class="tablelink">查看</a>     <a href="{{url('/admin/user/edit',[$v->id])}}" class="tablelink">修改</a>  <a   href="{{url('/admin/user/delete',[$v->id])}}" onclick="javascript:return p_del()"> 删除</a>  <!--  <a href="{{url('/admin/user/delete',[$v->id])}}" > 删除</a> --></td>
      </tr>
        @endforeach  
               
        </tbody>
    </table>
    


            <div class="pagin">
            	<div class="message">共<i class="blue">{!! $adminusers->total() !!}</i>条记录，当前显示第&nbsp;<i class="blue">{!! $adminusers->currentPage() !!}&nbsp;</i>页</div>
                <ul class="paginList">
        		       {!! $adminusers->appends($request)->render() !!}
                </ul>
            </div>
    
        
            <div class="tip" id="showtest">
    	<div class="tiptop"><span>提示信息</span><a></a></div>
        
      <div class="tipinfo">
        <span><img src="{{ URL::asset('adminlizzj/images/ticon.png') }}"></span>
        <div class="tipright">
             <p>是否删除这条信息？</p>
            <cite>如果是请点击确定按钮 ，否则请点取消。</cite>
        </div>
        </div>
        
        <div class="tipbtn">
        <input name="" class="sure" value="确定" type="submit" id="sureone">&nbsp;
        <input name="" class="cancel" value="取消" type="submit" id="cancelone">
        </div>
                
            </div>
        
    </div>
    <script type="text/javascript">
	   $('.tablelist tbody tr:odd').addClass('odd');

           function p_del() { 
        var msg = "您真的确定要删除吗？\n\n请确认！"; 
        if (confirm(msg)==true){ 
        return true; 
        }else{ 
        return false; 
        } 
        } 

          var error = document.getElementById('errorshow');
                    error.onclick = function(){
                        document.getElementById('errorshow').style.display = 'none';
                    }


      $('.clicks').click(function(){
            // 点击获取值
            var valArr = new Array;
            $("#listlizzj :checkbox[checked]").each(function(i){
                valArr[i] = $(this).val();
            });
             var id = valArr.join(',');//转换为逗号隔开的字符串
              if(id!=""){ // 自定义一个弹出框
                 document.getElementById('showtest').style.display = 'block'; 
                    var sures = document.getElementById('sureone');
                    sures.onclick = function(){

                                $.ajax({
                                url:'{{"/del"}}',
                                data:{id:id},
                                type:'get',
                                //同步
                                async:false,
                                success:function(data){
                                    //判断用户名是否可用
                                    if(data == 0){
                                        //删除成功
                                        alert('删除成功');
                                    }else{
                                        //删除失败
                                        alert('删除失败');
                                    }
                                },
                                error:function(){
                                    alert('ajax错误');
                                }
                            }) 

                    }
            }  else{  
            alert("请选择要删除的记录");  
            }  

            })  
	   </script>

		@endsection